﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Biz_Dal.Biz;

namespace Biz_Dal.Dal
{
    public class DalTonKho
    {
        internal static List<BizTonKho> GetTonKhoBySach(BizSach bizSach)
        {
            DalCommon dal = new DalCommon();
            var tk = from tk1 in dal.BookIdeas_ShopDataContext.TonKhos
                     where tk1.idSach == bizSach.idSach
                     orderby tk1.thoiGian descending
                     select new BizTonKho(tk1.idTonKho)
                     {
                         IdSach = tk1.idSach,
                         SoLuongTon = tk1.soLuongTon,
                         ThoiGian = tk1.thoiGian,
                         Sach = new BizSach(tk1.Sach.idSach),
                     };
            return tk.ToList<BizTonKho>();
        }
    }
}
